home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
InfoMagic Standards 1994 January
/
InfoMagic Standards - January 1994.iso
/
iso
/
9660
/
rockrdge
/
rrg.11
/
api.lib.nr
< prev
next >
Wrap
Text File
|
1992-08-19
|
11KB
|
612 lines
.sp
.H 2 "Definition of CD-ROM Specific Library Functions for Users"
.sp
This sections provides manual pages which describe CD-ROM library functions
for users in detail.
The library routines are:
.sp
.TS
center;
l l.
Name Description
\_ \_
cd_suf() Retrieve a System Use Field
cd_setdevmap() Set mappings of major/minor numbers
cd_getdevmap() Get mappings of major/minor numbers
.TE
.sp
.bp
.sp
.H 3 "cd_suf library routine"
.sp
.in 0
.ft 3
NAME
.ft 1
.br
.in 2
.ft 3
cd_suf
.ft 1
- read System Use Field from a specified System Use Area
.sp
.in 0
.ft 3
SYNOPSIS
.ft 1
.in 2
.ft 3
.br
#include <sys/cdrom.h>
.sp
int cd_suf (path, fsec, signature, index, buf, buflen)
.br
char *path;
.br
int fsec;
.br
char signature[2];
.br
int index;
.br
char *buf;
.br
int buflen;
.sp
.ft 1
.in 0
.ft 3
DESCRIPTION
.ft 1
.in 2
.br
.I Cd_suf\^
returns a System Use Field in the System Use Area for
.I path.\^
.sp
.I Path\^
points to a file or directory within the CD-ROM file hierarchy.
.sp
.I Fsec\^
specifies the File Section of that file.
The numbering starts with one.
If
.I fsec\^
is set to -1, the System Use Area of the last File Section of that file
is assumed.
.sp
.I Signature\^
is the 2 byte signature to look for and return from the System Use Area.
.sp
.I Index\^
is the occurrence of
.I signature\^
to return.
If
.I signature\^
is a NULL pointer, return the
.I index\^
System Use Field starting from the beginning of the System Use Area.
Otherwise, return the
.I index\^
occurrence of
.I signature.\^
The
.I index\^
number of the first System Use Field of any
.I signature\^
is one.
.sp
.I Buf\^
and
.I buflen\^
are the buffer and buffer length in which to place the System Use Field.
.sp
.in 0
.ft 3
RETURN VALUE
.ft 1
.in 2
.br
.I Cd_suf\^
will return the number of bytes placed in
.I buf\^
if successful.
.I Cd_suf\^
will return 0 if the
.I signature\^
field is not found.
In case of error, -1 is returned and
.I errno\^
is set to indicate the error.
.sp
.in 0
.ft 3
ERRORS
.ft 1
.in 2
.br
The
.I cd_suf()\^
function will fail if:
.sp
.VL 15
.LI "[EACCESS]"
Search permission is denied for a component of the
.I path\^
prefix or read permission on the file or directory pointed to by
.I path\^
is denied.
.LI "[ENAMETOOLONG]"
The length of the
.I path\^
string exceeds {PATH_MAX} or a pathname component is longer than
{NAME_MAX} while {_POSIX_NO_TRUNC} is in effect.
.LI "[ENOENT]"
A component of
.I path\^
does not exist or the
.I path\^
argument points to an empty string.
.br
The File Section indicated by
.I fsec\^
has no System Use Area.
.LI "[ENOTDIR]"
A component of the
.I path\^
prefix is not a directory.
.LI "[EFAULT]"
The address of
.I buf,\^
.I signature\^
or
.I path\^
is invalid.
.LI "[EINVAL]"
The value of
.I fsec,\^
.I index\^
or
.I buflen\^
is invalid.
.br
The argument
.I path\^
points to a file/directory not within a CD-ROM file hierarchy.
.LI "[ENODEV]"
The Volume containing the File Section indicated by
.I fsec\^
is not mounted.
.LI "[ENXIO]"
The CD-ROM is not in the drive or a read error occurred.
.LI "[EINTR]"
A signal was caught during the
.I cd_suf()\^
function.
.LI "[EMFILE]"
{OPEN_MAX} file descriptors are currently open in the calling process.
.LI "[ENFILE]"
The system file table is full.
.LE
.sp
.in 0
.ft 3
SEE ALSO
.ft 1
.in 2
.br
<sys/cdrom.h>
.sp
.in 0
.bp
.sp
.H 3 "cd_setdevmap library routine"
.sp
.in 0
.ft 3
NAME
.ft 1
.in 2
.br
.ft 3
cd_setdevmap
.ft 1
- set mappings of major/minor numbers
.sp
.in 0
.ft 3
SYNOPSIS
.ft 1
.in 2
.ft 3
.br
#include <sys/cdrom.h>
.sp
int cd_setdevmap (path, cmd, new_major, new_minor)
.br
char *path;
.br
int cmd;
.br
int *new_major;
.br
int *new_minor;
.sp
.ft 1
.in 0
.ft 3
DESCRIPTION
.ft 1
.in 2
.br
This function sets or unsets (based on
.I cmd\^)
the major and minor numbers of one device file on a mounted CD-ROM.
The argument
.I path\^
points to a file or directory within the CD-ROM file hierarchy.
.sp
If
.I cmd\^
is CD_SETDMAP, this function maps the
.I new_major
major number and the
.I new_minor
minor number to the device file pointed to by
.I path.
.I New_major\^
specifies the new major number for the device file.
.I New_minor\^
specifies the new minor number for the device file.
Any device file mapping for the device file
.I path\^
set with a previous invocation of
.I cd_setdevmap()\^
is overridden by this invocation of
.I cd_setdevmap().\^
.sp
If
.I cmd\^
is CD_UNSETDMAP, this function unmaps the mapped major and
minor numbers of the device file pointed to by
.I path.\^
The value of the recorded major number on the CD-ROM shall be returned in
.I new_major.\^
The value of the recorded minor number on the CD-ROM shall be returned in
.I new_minor.\^
.sp
See
.ft 3
Section 1.1, Mapping Device Files
.ft 1
for further information.
.sp
.in 0
.ft 3
RETURN VALUE
.ft 1
.in 2
.br
For CD_SETDMAP,
.I cd_setdevmap\^
will return one if the device file is successfully mapped
(a return value of zero means no more mappings allowed).
.sp
For CD_UNSETDMAP,
.I cd_setdevmap\^
will return one if the device file is successfully unmapped
(a return value of zero means mapping not found).
.sp
In case of error, -1 is returned and
.I errno\^
is set to indicate the error.
.sp
.in 0
.ft 3
ERRORS
.ft 1
.in 2
.br
.VL 15
.LI "[EACCESS]"
Search permission is denied for a component of the
.I path\^
prefix or read permission on the device file pointed to by
.I path\^
is denied.
.LI "[ENAMETOOLONG]"
The length of the
.I path\^
string exceeds {PATH_MAX} or a pathname component is longer than
{NAME_MAX} while {_POSIX_NO_TRUNC} is in effect.
.LI "[ENOENT]"
A component of
.I path\^
does not exist or the
.I path\^
argument points to an empty string.
.LI "[ENOTDIR]"
A component of the
.I path\^
prefix is not a directory.
.LI "[EFAULT]"
The address of
.I path,\^
.I new_major,\^
or
.I new_minor\^
is invalid.
.LI "[EINVAL]"
The value of
.I cmd\^
is invalid.
.br
The argument
.I path\^
points to a file/directory not within a CD-ROM file hierarchy.
.br
The file pointed to by
.I path\^
is not a device file.
.LI "[EPERM]"
User does not have appropriate privileges to set/unset device file
major/minor values.
.LI "[ENXIO]"
The CD-ROM is not in the drive or a read error occurred.
.LI "[EINTR]"
A signal was caught during the
.I cd_setdevmap()\^
function.
.LI "[EMFILE]"
{OPEN_MAX} file descriptors are currently open in the calling process.
.LI "[ENFILE]"
The system file table is full.
.LE
.sp
.in 0
.ft 3
APPLICATION USAGE
.ft 1
.in 2
.br
The use of
.I cd_setdevmap()\^
is restricted to a user with appropriate privileges.
The maximum number of mappings is defined in
.I <sys/cdrom.h>.\^
Mappings should be established before affected device files are used.
If this function is applied for device files that have already been opened,
the effect of this function on these files is undefined.
The device file mappings for a mounted CD-ROM are eliminated when the
CD-ROM is unmounted.
.sp
.in 0
.ft 3
SEE ALSO
.ft 1
.in 2
.br
<sys/cdrom.h>
.sp
.in 0
.bp
.sp
.H 3 "cd_getdevmap library routine"
.sp
.in 0
.ft 3
NAME
.ft 1
.in 2
.br
.ft 3
cd_getdevmap
.ft 1
- get mappings of major/minor numbers
.sp
.in 0
.ft 3
SYNOPSIS
.ft 1
.in 2
.ft 3
.br
#include <sys/cdrom.h>
.sp
int cd_getdevmap (path, pathlen, index, new_major, new_minor)
.br
char *path;
.br
int pathlen;
.br
int index;
.br
int *new_major;
.br
int *new_minor;
.sp
.ft 1
.in 0
.ft 3
DESCRIPTION
.ft 1
.in 2
.br
This function gets
the major and minor numbers of one device file on a mounted CD-ROM.
The argument
.I path\^
points to a file or directory within the CD-ROM file hierarchy.
The argument
.I index\^
refers to the \f2index\f1'th mapped device file.
Mappings can be obtained by
.I path\^
or
.I index.\^
.sp
If
.I index\^
is zero, this function gets the mapped major and minor numbers
of the device file pointed to by
.I path.\^
The value of the mapped major number shall be returned in
.I new_major.\^
The value of the mapped minor number shall be returned in
.I new_minor.\^
The value of
.I pathlen\^
is not used.
.sp
If
.I index\^
is not zero, this function gets the major and minor numbers
and pathname of the \f2index\f1'th mapped device file.
Numbering for
.I index\^
starts at one.
The value of the mapped major number shall be returned in
.I new_major.\^
The value of the mapped minor number shall be returned in
.I new_minor.\^
The pathname of the device file shall be returned in
.I path.\^
If the length of the pathname for the device file is longer than
.I pathlen\^
the pathname returned in
.I path\^
will be truncated to
.I pathlen\^
length and will not be NULL terminated.
.sp
See
.ft 3
Section 1.1, Mapping Device Files
.ft 1
for further information.
.sp
.in 0
.ft 3
RETURN VALUE
.ft 1
.in 2
.br
.I cd_getdevmap\^
will return the length of pathname if the device file is
successfully returned
(a return value of zero means mapping not found).
Note: if the pathname is truncated, the return value will be
larger than
.I pathlen.\^
.sp
In case of error, -1 is returned and
.I errno\^
is set to indicate the error.
.sp
.in 0
.ft 3
ERRORS
.ft 1
.in 2
.br
.VL 15
.LI "[EACCESS]"
Search permission is denied for a component of the
.I path\^
prefix or read permission on the device file pointed to by
.I path\^
is denied.
.LI "[ENAMETOOLONG]"
The length of the
.I path\^
string exceeds {PATH_MAX} or a pathname component is longer than
{NAME_MAX} while {_POSIX_NO_TRUNC} is in effect.
.LI "[ENOENT]"
A component of
.I path\^
does not exist or the
.I path\^
argument points to an empty string.
.LI "[ENOTDIR]"
A component of the
.I path\^
prefix is not a directory.
.LI "[EFAULT]"
The address of
.I path,\^
.I new_major,\^
or
.I new_minor\^
is invalid.
.LI "[EINVAL]"
The value of
.I index\^
or
.I pathlen\^
is invalid.
.br
The argument
.I path\^
points to a file/directory not within a CD-ROM file hierarchy.
.br
The file pointed to by
.I path\^
is not a device file.
.LI "[ENXIO]"
The CD-ROM is not in the drive or a read error occurred.
.LI "[EINTR]"
A signal was caught during the
.I cd_getdevmap()\^
function.
.LI "[EMFILE]"
{OPEN_MAX} file descriptors are currently open in the calling process.
.LI "[ENFILE]"
The system file table is full.
.LE
.sp
.in 0
.ft 3
APPLICATION USAGE
.ft 1
.in 2
.br
The maximum number of mappings is defined in
.I <sys/cdrom.h>.\^
The device file mappings for a mounted CD-ROM are undone when the
CD-ROM is unmounted.
.sp
The
.I index\^
numbers from 1 to
.I n\^
(where
.I n\^
is the number of the last device file mapping)
are always guaranteed to have a device file mapping associated
with the number.
Thus if an application wishes to successively delete all
device file mappings, one at a time, it would call
.I cd_getdevmap()\^
with
.I index\^
equal to 1, and then
.I cd_setdevmap()\^
with CD_UNSETDMAP in a loop until
.I cd_getdevmap()\^
returns zero.
.sp
.in 0
.ft 3
SEE ALSO
.ft 1
.in 2
.br
<sys/cdrom.h>
.sp
.in 0
.bp